#ifndef PRINTERPDF_H
#define PRINTERPDF_H

#include <QObject>

#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <iostream>
#include <cups/cups.h>
#include <cairo/cairo.h>
#include <cairo/cairo-ps.h>
using namespace std;

class PrinterPdf : public QObject
{
    Q_OBJECT
public:
    explicit PrinterPdf(QObject *parent = 0);
    void    setWidth(int width);
    int     getWidth();
    void    setHeight(int height);
    int     getHeight();
    void    setFieldSz(int fieldSz);
    int     getFieldSz();
    void    setInputFile(QString csvFile);
    void    setOutputFile(QString pdfName);
    bool    print();
    
signals:
    void    printed();
    
public slots:
    void    printing();

private:
    bool    ready;
    int     width_;
    int     height_;
    int     fieldSz_;
    string  inFileRoot;
    string  outFileName;
    const char*   tmpfilename;

    string  createRow(string row, string delimiter);
    string  createField(string fieldStr);
    vector<string>  prepareTempData();
    void    drawTempData();
};

#endif // PRINTERPDF_H
